This is a draft version of a MISRA C++ 202x rule proposed for public review.
MISRA Rule 19.3.1
Category: Advisory
Analysis Type: Decidable,Single Translation Unit
Rationale
The order of evaluation associated with multiple #
, multiple ##
or a mix of #
and ##
preprocessor operators is unspecified. It is therefore not always possible to predict the result of macro expansion.
The use of the ##
operator can result in code that is hard to understand.
Note: MISRA C++ 2023 Rule 4.1.3 (There shall be no occurrence of undefined or critical unspecified
behaviour) covers the undefined behaviour that arises if either:
- The result of a
#
operator is not a valid string literal; or
- The result of a
##
operator is not a valid preprocessing token.
Copyright The MISRA Consortium Limited © 2023